package com.engine4cloud.tdf.supervision.feign;

import com.engine4cloud.tdf.common.core.constant.SecurityConstants;
import com.engine4cloud.tdf.common.core.constant.ServiceNameConstants;
import com.engine4cloud.tdf.common.core.util.R;
import com.engine4cloud.tdf.common.data.web.response.PageInfo;
import com.engine4cloud.tdf.common.data.web.response.Params;
import com.engine4cloud.tdf.supervision.dto.create.SpChangePlaceCreateDTO;
import com.engine4cloud.tdf.supervision.dto.query.SpChangePlaceQueryDTO;
import com.engine4cloud.tdf.supervision.dto.result.EnumsTypeResultDTO;
import com.engine4cloud.tdf.supervision.dto.result.SpChangePlaceResult;
import com.engine4cloud.tdf.supervision.dto.update.SpChangePlaceUpdateDTO;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.Valid;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 审批-执行地变更管理
 *
 * @author sh
 * @date 2024-08-02 15:07:07
 */
@FeignClient(contextId = "RemoteSpChangePlaceService", value = ServiceNameConstants.SUPERVISION_SERVER)
public interface RemoteSpChangePlaceService {

    /**
     * 新增矫正对象现场签到
     *
     * @param dto 矫正对象现场签到
     * @return R
     */
    @PostMapping("/inner/change/place")
    R<Boolean> apply(@Valid @RequestBody SpChangePlaceCreateDTO dto, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 通过id查询矫正对象现场签到
     *
     * @param dto 矫正对象现场签到
     * @return R
     */
    @PutMapping("/inner/change/place")
    R<Boolean> update(@Valid @RequestBody SpChangePlaceUpdateDTO dto, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 通过id查询执行地变更信息
     *
     * @param id id
     * @return R
     */
    @Operation(summary = "通过id查询", description = "通过id查询")
    @GetMapping("/inner/change/place/{id}")
    R<SpChangePlaceResult> getById(@PathVariable("id") Long id, @RequestHeader(SecurityConstants.FROM) String from);

    /**
     * 分页查询
     *
     * @param page 分页对象
     * @param dto  执行地变更信息
     * @return R<PageInfo < SpChangePlaceResult>>
     */
    @GetMapping("/inner/change/place/page")
    R<PageInfo<SpChangePlaceResult>> pageList(@RequestParam("page") Params page, @Valid @RequestParam("dto") SpChangePlaceQueryDTO dto,
                                              @RequestHeader(SecurityConstants.FROM) String from);
    /**
     * 执行地变更类型
     */
    @GetMapping("/inner/change/place/category")
    R<List<EnumsTypeResultDTO>> category(@RequestHeader(SecurityConstants.FROM) String from);
}
